<?php

abstract class AbstractBackendEntityViewController extends AbstractBackendViewController
{

    public function handleRequest(Request $request, Response $response, View $view)
    {
        parent::handleRequest($request, $response, $view);

        $this->switchAction($request);
    }

    protected function switchAction(Request $request)
    {
        $action = $request->getParam(0);
        switch ($action) {
            case 'create':
                $this->handleCreateAction();
                break;
            case 'delete':
                $this->handleDeleteAction();
                break;
            case 'edit':
                $this->handleEditAction();
                break;
            default:
                $this->handleListAction();
                break;
        }
    }
    
    abstract protected function handleCreateAction();

    abstract protected function handleDeleteAction();

    abstract protected function handleEditAction();

    abstract protected function handleListAction();
}